package kathy_java6.cap7;

import java.util.Set;
import java.util.TreeSet;

class Car{
	Integer numSerie;
	String modelo;
	public Car(int numSerie, String modelo){
		this.numSerie = numSerie;
		this.modelo = modelo;
	}
	public boolean equals(Object car){
		if(car instanceof Car && (((Car)car).numSerie == this.numSerie))
			return true;
		else
			return false;
	}
}

public class TestEquals {
	public static void main(String[] args) {
		Car c1= new Car(10, "Popular");
		Car c2 = new Car(12,"Luxo");
		Car c3 = new Car(29,"Medio");
		Car c4 = new Car(10,"Super Luxo");
		/*Set s = new TreeSet();
		s.add(c2);
		s.add(c1);
		s.add(c3);
		s.add(c4);
		System.out.println(s);*/
		System.out.println(c1.equals(c2));
		System.out.println(c1.equals(c3));
		System.out.println(c1.equals(c4));
	}
}
